
import java.io.FileNotFoundException;//文件未找到异常
import java.io.FileOutputStream;//文件输出流
import java.io.IOException;//IO异常

public class FileOutputStreamDemo {
    public static void main(String[] args) throws IOException, FileNotFoundException {
        int count = 0;
        String filename = "t2.txt";  //该文件作为输出源
        FileOutputStream fos = new FileOutputStream(filename, true);
        for (int n = 10; n <= 200; n++) {
            if (n % 3 == 0) {
                count++;
                String str = String.valueOf(n)+ "\t"; //n转字符串，加上tab键
                fos.write(str.getBytes());
                if (count % 10 == 0) { //10个换行
                    fos.write("\r\n".getBytes());
                }
            }
        }
        fos.close();
    }
}
